package com.example.finalwork06.Mapper;

import com.example.finalwork06.Entity.NewShares;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface NewSharesMapper {
    @Select("SELECT * FROM NEW_SHARES_CALENDAR ORDER BY SDATE DESC")
    public List<NewShares> list();

    @Insert("INSERT INTO NEW_SHARES_CALENDAR(SNAME,SDATE) VALUES(#{sName},#{sDate})")
    public void insertNewShares(NewShares newShares);

    @Select("select count(*) FROM NEW_SHARES_CALENDAR WHERE sName=#{name}")
    public boolean selectByName(String name);

    @Update("UPDATE NEW_SHARES_CALENDAR SET SDATE=#{time} WHERE SName=#{name}")
    public void updateShares(@Param("time") Date time, @Param("name")String name);

}
